{extend name="base"/}
{block name="title"}{/block}
{block name="main"}
<div class="x-body">
    <form class="layui-form">
        {volist name="users" id="vo"}
        <input type="hidden" value="{$vo.staff_id}">
        <div class="layui-form-item">
            <label for="L_username" class="layui-form-label">
                昵称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="L_username" name="username" disabled="" value="{$vo.login_name}" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
                <span class="x-red">*</span>旧密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="oldPass" name="oldpass" required lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_pass" class="layui-form-label">
                <span class="x-red">*</span>新密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="newPass" name="newpass" required lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                6到16个字符
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
                <span class="x-red">*</span>确认密码
            </label>
            <div class="layui-input-inline">
                <input type="password" id="rePass" name="repass" required lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" onclick="EidtPwd(this,{$vo.staff_id})" lay-filter="save" lay-submit="">
                确定修改
            </button>
        </div>
        {/volist}
    </form>
</div>
{/block}
{block name="script"}
<script>
  function EidtPwd(obj,id) {
     var params = {};
     params.staff_id = id;
     params.oldPass = $.trim($('#oldPass').val());
     params.newPass = $.trim($('#newPass').val());
     params.rePass = $.trim($('#rePass').val());
      if(params.oldPass==''){
          layer.msg('用户名不能为空',{time:1000});
          $("#oldPass").focus();
          return false;
      }
     $.post("{:url('admin/Users/usersEditPwd')}",params,function(data){
          if(data>0){
              layer.msg("修改成功",{time:1000});
              location.href="{:url('admin/Users/user')}"
          }else{
              alert('失败');
          }
     });
  }
</script>
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
{/block}
